package com.josn.dingshidemo;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {

    /**
     * 新增用户
     */
    @Insert("insert into user(id,username) values (#{id},#{username});")
    void adduser(User user);

    /**
     * 查询用户
     */
    @Select("select * from user where id =#{id};")
    User QueryById(String id);

    /**
     * 查询所有用户
     */
    @Select("select * from user;")
    List<User> QueryAllUser();
} 
